﻿namespace ExamV5.StudyInfo
{
    using ExamV5;
    using System;
    using System.Configuration;
    using System.Data;
    using System.Data.SqlClient;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;

    public class FrmLookStudyInfo : Page
    {
        protected Button butClose;
        protected HtmlForm form1;
        protected HtmlHead Head1;
        private HttpCookie httpCookie_0 = null;
        private HttpCookie httpCookie_1 = null;
        private HttpCookie httpCookie_2 = null;
        private HttpCookie httpCookie_3 = null;
        protected int intID = 0;
        protected Label labJFen;
        protected Label labPlanForm;
        protected Label labPlanMemo;
        protected Label labPlanName;
        protected Label labSEDate;
        protected Label labStudyDoc;
        protected Label labStudyFen;
        protected Label labStudyTimeLong;
        private PublicFun publicFun_0 = new PublicFun();
        protected string strReUserCode = "";
        protected string strReUserName = "";
        protected string strWorkCode = "";
        protected string strWorkName = "";

        private void method_0()
        {
            string cmdText = "select IsAdd,LastWork,FenValue,StudyFen,PlanName,PlanMemo,StudyUserCode,StudyUserName,StudyType,StudyDocID,StudyLongTime,PlanStartTime,PlanEndTime from StudyPlanInfo where ID=" + this.intID;
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            connection.Open();
            SqlCommand command = new SqlCommand(cmdText, connection);
            SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
            try
            {
                if (reader.Read())
                {
                    this.labJFen.Text = reader["FenValue"].ToString();
                    this.labStudyFen.Text = reader["FenValue"].ToString();
                    this.labSEDate.Text = reader["PlanStartTime"].ToString() + "—" + reader["PlanEndTime"].ToString();
                    this.labPlanName.Text = reader["PlanName"].ToString();
                    this.labPlanMemo.Text = reader["PlanMemo"].ToString();
                    if (!(reader["StudyType"].ToString() == "A"))
                    {
                        this.labPlanForm.Text = "电子课件";
                        this.labStudyDoc.Text = this.publicFun_0.GetValues("select LessionName from LessionInfo where ID=" + reader["StudyDocID"].ToString(), "LessionName");
                    }
                    else
                    {
                        this.labPlanForm.Text = "电子教材";
                        this.labStudyDoc.Text = this.publicFun_0.GetValues("select SubjectName from BookInfo where ID=" + reader["StudyDocID"].ToString(), "SubjectName");
                    }
                    this.labStudyTimeLong.Text = reader["StudyLongTime"].ToString() + " 小时";
                }
            }
            catch
            {
            }
            finally
            {
                reader.Close();
                command.Dispose();
                connection.Close();
                connection.Dispose();
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            this.httpCookie_0 = new HttpCookie("ExamUserCode");
            this.httpCookie_0 = base.Request.Cookies["ExamUserCode"];
            this.httpCookie_1 = new HttpCookie("ExamUserName");
            this.httpCookie_1 = base.Request.Cookies["ExamUserName"];
            this.httpCookie_2 = new HttpCookie("ExamUserLevel");
            this.httpCookie_2 = base.Request.Cookies["ExamUserLevel"];
            this.httpCookie_3 = new HttpCookie("ExamDeptID");
            this.httpCookie_3 = base.Request.Cookies["ExamDeptID"];
            if ((this.httpCookie_0 != null) ? !(this.httpCookie_0.Value == "") : false)
            {
                base.Response.Cache.SetCacheability(HttpCacheability.NoCache);
                base.Response.Cache.SetNoStore();
                this.httpCookie_0.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_0.Value));
                this.httpCookie_1.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_1.Value));
                this.httpCookie_2.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_2.Value));
                this.httpCookie_3.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_3.Value));
                this.intID = Convert.ToInt32(base.Request["ID"].ToString());
                base.Title = ConfigurationManager.ConnectionStrings["ProTitle"].ConnectionString + "---定制学习任务";
                if (Convert.ToInt32(ConfigurationManager.ConnectionStrings["OnlineNum"].ConnectionString) != 0x3a)
                {
                    if (!base.IsPostBack)
                    {
                        if (this.publicFun_0.ReturnPaperData() != "Yes")
                        {
                            base.Response.Write("<script>alert('此版本暂未授权,请拔打(0)13870606104手机号进行授权！')</script>");
                        }
                        else if (this.intID != 0)
                        {
                            this.method_0();
                        }
                    }
                }
                else
                {
                    base.Response.Write("<script>alert('该版本为特惠版，此功能未开放！')</script>");
                }
            }
            else
            {
                base.Response.Write("<script language=javascript>top.location.href='../Index.htm';self.close();</script>");
            }
        }
    }
}

